package RawDict;

public class MulTagString extends TagString {
	public MulTagString nxtString = null;
	
	protected static int FindNextTag(String s){
		int startPos = s.indexOf(preTag, TagSize);
		assert(startPos == -1 || s.charAt(startPos + 2) == posTag);
		return startPos;
	}
	
	public static MulTagString Import(String s){
		if(s == null || s.length() == 0){
			return null;
		}
		assert(s.charAt(0) == preTag);
		MulTagString rev = new MulTagString();
		rev.tag = GetTag(s);
		int nextTagPos = FindNextTag(s);
		if(nextTagPos != -1){
			if(nextTagPos > TagSize){
				rev.content = s.substring(TagSize, nextTagPos);
			}
			rev.nxtString = MulTagString.Import(s.substring(nextTagPos));
		}
		else{
			rev.content = s.substring(TagSize);
			rev.nxtString = null;
		}
		return rev;
	}
}
